# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=py3-textual
_pyname=${pkgname#py3-}
pkgver=0.47.1
pkgrel=1
pkgdesc="TUI framework for Python inspired by modern web development"
url="https://github.com/Textualize/textual"
arch="noarch"
license="MIT"
depends="
	python3
	py3-importlib-metadata
	py3-linkify-it-py
	py3-markdown-it-py
	py3-rich
	py3-typing-extensions
	"
makedepends="py3-gpep517 py3-poetry-core"
checkdepends="
	py3-aiohttp
	py3-click
	py3-jinja2
	py3-msgpack
	py3-nanoid
	py3-pytest
	py3-pytest-aiohttp
	py3-pytest-asyncio
	py3-syrupy
	py3-time-machine
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/Textualize/textual/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/$_pyname-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl

	# test_snapshots.py requires pytest-textual-snapshot, which depends on py3-textual itself, for snap_compare fixture
	# test_languages.py requires optional tree_sitter_languages Python package
	# test_features.py is broken
	.testenv/bin/python3 -m pytest \
		--ignore=tests/snapshot_tests/test_snapshots.py \
		--ignore=tests/text_area/test_languages.py \
		--ignore=tests/test_features.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
f17684f8e822423164a6b549c261f5662b6997e9934e1c76f159610d1ed682e26d34e39ae22c3b8fe47e84c8b4a87cc6bd70e0121806b498ddda5ddb9f575bd1  py3-textual-0.47.1.tar.gz
"
